package com.mybatis.demo.mapper;

import com.mybatis.demo.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {

//    @Select("select * from user")
//    @Results({
//        @Result(property = "name", column = "name"),
//        @Result(property = "nickName", column = "nick_name"),
//        @Result(property = "age", column = "age")
//    })
    List<User> findAll();

//    @Insert("INSERT INTO user(name, nick_name, age) VALUES(#{name}, #{nickName}, #{age})")
    void insert(User user);

//    @Update("UPDATE user SET name=#{name}, nick_name = #{nickName}, age=#{age} where id = #{id}")
    void update(User user);

//    @Delete("delete from user where id = #{id}")
    void delete(int id);
}
